export default {
  addTodo (state, form) {
    const text = form.input;
    const date = form.date;
    const time = form.time;
    state.todos.push({
      id: state.id++,
      text,
      date,
      time,
      isFinished: false
    })
  },
  toggleTodo (state, id) {
    state.todos = state.todos.map(todo => {
      if (todo.id === id) {
        todo.isFinished = true;
      }
      return todo
    })
  },
  removeTodo (state, id) {
    state.todos = state.todos.filter(todo => todo.id !== id);
  },
  setFilter (state, filter) {
    state.filter = filter
  }
}